<!DOCTYPE html>
<html>
<head>
    <title>推荐客户</title>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <link rel="stylesheet" href="${s.base}/mobile/base/css/weui.min.css">
    <link rel="stylesheet" href="${s.base}/mobile/base/css/jquery-weui.css">
    <link rel="stylesheet" href="${s.base}/mobile/base/css/base.css?123456">
    <link rel="stylesheet" href="${s.base}/mobile/base/css/component.css?123456">
    <link rel="stylesheet" type="text/css" href="${s.base}/mobile/base/lib/DateSelector/DateSelector.css?rev=@@hash"/>
    <style type="text/css">
        body, html {
            background: #ffffff;
        }
        .weui-cell {
            padding: 20px 30px;
        }
        .weui-cells{
            line-height: 2;
            font-size: 28px;
        }
        .toolbar .toolbar-inner{
            height: 3.4rem;
        }
        .toolbar .title{
            font-size: 34px;
            line-height: 3.4rem;
        }
        .toolbar .picker-button{
            height: 3.4rem;
            line-height: 3.4rem;
            font-size: 28px;
        }
        .weui-btn{line-height: 90px; height: 90px; font-size: 28px; width: 80%;}
        button.weui-btn, input.weui-btn{width: 80%;}
        .date-selector-container{height: 350px;}
        .date-selector-content .date-selector{height: 270px;}
        .date-selector-tab-box{height: 47px;line-height: 47px; color: #999999; }
        .date-selector-btn-box{height: 80px; line-height: 80px;}
        .date-selector-btn-box .date-selector-btn{color: #000000;}
        .date-selector-tab-box .date-selector-tab-active{color: #666666;}
        .date-selector-content{top:80px;}
        .date-selector-content li {
            font-size: 28px;
        }
    </style>
</head>
<body>
<div class="xyg-comp-form">
    <div class="backgroud1">
        <div class="xyg-comp-form-item-one">
            <div class="xyg-comp-form-item-title">
                客户姓名
            </div>
            <div class="xyg-comp-form-item-content">
                <input type="text" id="name" placeholder="请先输入客户姓名"/>
            </div>
            <div class="clearBoth"></div>
        </div>
        <div class="xyg-comp-form-item-one">
            <div class="xyg-comp-form-item-title">
                客户性别
            </div>
            <div class="xyg-comp-form-item-icon" >
                <input type="text" id="sex" placeholder="请先选择客户性别"/> <span><svg class="icon" aria-hidden="true">
                  <use xlink:href="#iconxiangyou"></use>
                 </svg> </span>
            </div>
            <div class="clearBoth"></div>
        </div>
        <div class="xyg-comp-form-item-one">
            <div class="xyg-comp-form-item-title">
                电话号码
            </div>
            <div class="xyg-comp-form-item-content">
                <input type="number" id="phone" placeholder="请先输入手机号"/>
            </div>
            <div class="clearBoth"></div>
        </div>
        <div class="xyg-comp-form-item-one">
            <div class="xyg-comp-form-item-title">
                客户身份证
            </div>
            <div class="xyg-comp-form-item-content">
                <input type="text" id="idCard" placeholder="请先输入身份证后六位"/>
            </div>
            <div class="clearBoth"></div>
        </div>
        <div class="xyg-comp-form-item-one">
            <div class="xyg-comp-form-item-title">
                推荐楼盘
            </div>
            <input type="hidden" value="${currentHostItem.id}" name="itemId" id="itemId"/>
            <div class="xyg-comp-form-item-icon">
                <span id="itemName"> ${currentHostItem.name!'选择楼宇'}</span>
            </div>
            <div class="clearBoth"></div>
        </div>
        <div class="xyg-comp-form-item-one">
            <div class="xyg-comp-form-item-title">
                经纪人
            </div>
            <div class="xyg-comp-form-item-content">
                <input type="text" id="setUpBusiness" placeholder="请先输入经纪人名字及电话"/>
            </div>
            <div class="clearBoth"></div>
        </div>
        <div class="xyg-comp-form-item-one  margT20">
            <div class="xyg-comp-form-item-title">
                看房日期
            </div>
            <div class="xyg-comp-form-item-content">
                <input type="text" id="useTime" readonly placeholder="请选择看房日期" />
                <div id="targetContainers"></div>
            </div>
            <div class="clearBoth"></div>
        </div>
        <div class="xyg-comp-form-item-one">
            <div class="xyg-comp-form-item-title">
                备注(选填)
            </div>
            <div class="xyg-comp-form-item-content">
                <input type="text" id="remarks" placeholder="请先输入备注"/>
            </div>
            <div class="clearBoth"></div>
        </div>
        <div class="xyg-comp-form-item">
            <div class="xyg-comp-form-item-textarea-content">
                <textarea class="font-base4-size" id="moreRemarks" placeholder="请输入补充说明（选填）"></textarea>
            </div>
        </div>
    </div>
    <div class="margT60 width-b-80">
        <div onclick="submit()" class="xyg-btn-two backgroud4 color2" >确认推荐</div>
    </div>

</div>

<!--底部菜单开始-->
<div style="width:100%; height:128px;"></div>
<div class="xyg-comp-bottom3">
    <div class="xyg-comp-bottom-item">
        <a href="javascript:goFistPage('${memberId}')">
            <img src="${s.base}/mobile/base/images/icon_menu_1_a.png"/>
            <div class="xyg-comp-bottom-item-text select-text">首页</div>
        </a>
    </div>
    <div class="xyg-comp-bottom-item">
        <a href="javascript:goAllCustomerEditPage('${memberId}')">
            <img src="${s.base}/mobile/base/images/icon_menu_2.png"/>
            <div class="xyg-comp-bottom-item-text">推荐</div>
        </a>
    </div>
    <div class="xyg-comp-bottom-item">
        <a href="javascript:goMyPage('${memberId}')">
            <img src="${s.base}/mobile/base/images/icon_menu_3.png"/>
            <div class="xyg-comp-bottom-item-text">我的</div>
        </a>
    </div>
    <div class="clearBoth"></div>
</div>
<!--底部菜单结束-->
</body>
<script src="https://res.wx.qq.com/open/js/jweixin-1.3.2.js"></script>
<script src="${s.base}/mobile/base/js/jquery-2.1.4.js"></script>
<script src="${s.base}/mobile/base/js/jquery-weui.js"></script>
<script src="${s.base}/mobile/base/js/swiper.js"></script>
<script src="${s.base}/mobile/base/fonts/iconfont.js"></script>
<script src="${s.base}/mobile/base/js/component.js"></script>
<script src="${s.base}/mobile/base/lib/DateSelector/DateSelector.js"></script>
<script src="${s.base}/mobile/base/js/base.js?123456789000"></script>
<script type="text/javascript">
    initXygDpi();
    var memberId='${memberId}';
    new DateSelector({
        input: 'useTime',//点击触发插件的input框的id
        container: 'targetContainers',//插件插入的容器id
        type: 1,
        param: [1, 1, 1, 1, 1],
        beginTime: [${currentDate?string('yyyy')}, ${currentDate?string('MM')}, ${currentDate?string('dd')}, ${currentDate?string('HH')}, ${currentDate?string('mm')}],//如空数组默认设置成1970年1月1日0时0分开始，如需要设置开始时间点，数组的值对应param参数的对应值。
        endTime: [2027, 5, 7, 12, 2],//如空数组默认设置成次年12月31日23时59分结束，如需要设置结束时间点，数组的值对应param参数的对应值。
        recentTime: [${currentDate?string('yyyy')}, ${currentDate?string('MM')}, (${currentDate?string('dd')})*1+1, ${currentDate?string('HH')}, ${currentDate?string('mm')}],
        success: function (arr, arr2) {
            $("#useTime").val(arr2[0]+"-"+arr2[1]+"-"+arr2[2]+" "+arr2[3]+":"+arr2[4])
        }//回调
    });

    $(document).ready(function(e) {
        initDate();
    });

    function initDate() {
        $("#sex").select({
            title: "选择性别",
            items:[{
                title: "男",
                value: 1
            },{
                title: "女",
                value: 2
            }]
        });
    }

    function submit() {
        var itemId = $("#itemId").val();
        var name = $("#name").val();
        var idCard = $("#idCard").val();
        if(name == null || name == "") {
            $.toast("请填写客户信息", "text");
            return false;
        }
        var sex = $("#sex").attr("data-values");
        if(sex == null || sex == "") {
            $.toast("请选型性别", "text");
            return false;
        }
        var phone = $("#phone").val();
        if(phone == null || phone == "") {
            $.toast("请输入手机号", "text");
            return false;
        }else if(!(/^1(3|4|5|6|7|8|9)\d{9}$/.test(phone))){
            $.toast("手机码填写错误", "text");
            return false;
        }

        var setUpBusiness = $("#setUpBusiness").val();
        if(setUpBusiness == null || setUpBusiness == "") {
            $.toast("请输入经纪人姓名及电话", "text");
            return false;
        }
        var useTime = $("#useTime").val();
        if(useTime == null || useTime == "") {
            $.toast("请选择到访时间", "text");
            return false;
        }
        var remarks = $("#remarks").val();
        var moreRemarks = $("#moreRemarks").val();
        $.fn.postMethodResult("/weChat/reportSave",{'idCard':idCard,'itemId':itemId,'name':name,'sex':sex,'phone':phone,'useTimeStr':useTime,'remarks':remarks,'memberId':memberId,
            'setUpBusiness':setUpBusiness,'moreRemarks':moreRemarks},function (data) {
            $.alert("提交成功！",function () {
                window.location.reload();
            });
        });
    }

    var sendFlage=true;//发送标志，true为可以发送
    function sendSms(){
        if(!sendFlage){
            return false;
        }
        sendFlage=false;
        var phone = $("#phone").val();
        if(phone == null || phone == "") {
            $.toast("请输入手机号", "text");
            sendFlage=true;
            return false;
        }else if(!(/^1(3|4|5|6|7|8|9)\d{9}$/.test(phone))){
            $.toast("手机码填写错误", "text");
            sendFlage=true;
            return false;
        }

        $.fn.postBase("/weChat/smsSend",{'phone':phone},function (result) {
            if (result.code === 0) {
                //操作成功
                $.toast("短信发送成功", "text");
                getRandomCode();
            } else {
                sendFlage=false;
                //操作失败
                $.toast(result.msg, "text");
            }
        });
    }

    var time = 60;
    //倒计时
    function getRandomCode() {
        if (time === 0) {
            time = 60;
            sendFlage=true;
            $('#sendSms').html("获取验证码");
            return;
        } else {
            time--;
            $('#sendSms').html(time+"秒");
        }
        setTimeout(function() {
            getRandomCode();
        },1000);
    }
</script>
</html>
